package com.jic.market.controller.manage;

import com.jic.common.base.vo.RestResult;
import com.jic.market.api.manage.PromotionLimitRuleApi;
import com.jic.market.request.PromotionLimitRuleRequest;
import com.jic.market.service.PromotionLimitRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * description: PromotionLimitRuleManageController
 * date: 2020/1/16 19:22
 * author: admin
 * version: 1.0
 */
@RestController
@RequestMapping("promotionLimitRule")
public class PromotionLimitRuleManageController implements PromotionLimitRuleApi {

    @Autowired
    PromotionLimitRuleService promotionLimitRuleService;

    @ResponseBody
    @RequestMapping("updatePriceOrLimit")
    @Override
    public RestResult updatePriceOrLimit(@RequestBody PromotionLimitRuleRequest ruleRequest) {
        promotionLimitRuleService.updatePriceOrLimit(ruleRequest);
        return RestResult.success(null);
    }

    @ResponseBody
    @RequestMapping("insert")
    public RestResult<Long> insert(@RequestBody PromotionLimitRuleRequest ruleRequest) {
        return RestResult.success(promotionLimitRuleService.insert(ruleRequest));
    }

    @ResponseBody
    @RequestMapping("delete")
    @Override
    public RestResult delete(PromotionLimitRuleRequest ruleRequest) {
        return RestResult.success(null);
    }
}
